package com.unhz.taigu.service.impl;

import com.unhz.generator.dao.ReceivingInfoMapper;
import com.unhz.generator.pojo.ReceivingInfo;
import com.unhz.taigu.service.ReceivingInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: 魏运奇
 * @Description:
 * @Date: Created in 下午 6:42 2018/2/2 0002
 * @Modified By: V1.0.0
 */
@Service
public class ReceivingInfoServiceImpl implements ReceivingInfoService{

    @Autowired
    private ReceivingInfoMapper receivingInfoMapper;

    //查询试做收货信息(接口)
    @Override
    public ReceivingInfo selectByUserId(Integer userId) {
        return  receivingInfoMapper.selectByUserId(userId);
    }

    //添加试做收货信息
    @Override
    public int insertAddress(ReceivingInfo receivingInfo) {
        int number= receivingInfoMapper.insertSelective(receivingInfo);
         return    number;
    }

    //通过用户id查询试做收货信息
    @Override
    public ReceivingInfo findByUserId(Integer userId) {
        return receivingInfoMapper.findByUserId(userId);
    }

    @Override
    public ReceivingInfo selectReceivingInfo(Integer userId) {
        return receivingInfoMapper.selectReceivingInfo(userId);
    }

    @Override
    public List<ReceivingInfo> selectAllReceivingInfo(Integer userId) {
        return receivingInfoMapper.selectAllReceivingInfo(userId);
    }

    @Override
    public int updateReceivingInfo(ReceivingInfo receivingInfo) {

        System.out.println(receivingInfo.getId()+"------------dashdujhk---------"+receivingInfo.getId());
        return receivingInfoMapper.updateByPrimaryKeySelective(receivingInfo);
    }

    @Override
    public int updateReceivingInfoid(ReceivingInfo receivingInfo) {

        System.out.println(receivingInfo.getId()+"------------dashdujhk---------"+receivingInfo.getId());
        return receivingInfoMapper.updateByPrimaryKeySelectiveid(receivingInfo);
    }
}
